package com.ruoyi.web.controller.platform;

import javax.xml.namespace.QName;
import javax.xml.soap.SOAPHeaderElement;

public class testController {

    /*

    //方法名
//        Method method = set"PopulationIndex";


    //参数  两癌上报
    String url = "https://59.211.16.98:19438/BasWebService.asmx?wsdl";
    //        URL url = new URL("https://59.211.16.98:19438/BasWebService.asmx?wsdl");
//        String param = "<Request><id_no>450923198503116990</id_no></Request>";
    String param1 = "bas4501030014";
    String param2 = "45010300142816202@gxwst";
    String id_no = "452130198310190045";
    String param3 = "<![CDATA[<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
            "         <request>\n" +
            "<head>\n" +
            " <function>GetPersonIndex</function>\n" +
            " <operation>0</operation>\n" +
            "</head>\n" +
            "<body>\n" +
            "<parameter>"+id_no+"</parameter>\n" +
            " <id_no>452130198310190045</id_no>\n" +
            "</body>\n" +
            "</request>]]>";

    SoapClient soapClient = SoapClient.create(url)
            // 设置调用方法名称以及命名空间
            .setMethod("PopulationIndex", "http://microsoft.com/webservices/")
//                .addSOAPHeader("Password", param2)
            // 设置参数名称及参数值
//                .setParam("Uname", param1)
//                .setParam("Password", param2)
            .setParam("ProductId", param3)
            // 设置超时时间
            .setConnectionTimeout(15000)
            .setReadTimeout(15000)
            .timeout(15000);

    //添加表头和表头分区，空间名称和表头分隔字符
    SOAPHeaderElement soapHeaderElement = soapClient.getMessage().getSOAPHeader().addHeaderElement(new QName("http://microsoft.com/webservices/","MySoapHeader"));
    //添加表头参数
        soapHeaderElement.addChildElement("Uname").setValue("bas4501030014");
        soapHeaderElement.addChildElement("Password").setValue("45010300142816202@gxwst");



    String result = soapClient.send();
        System.out.println(result);

     */
}
